package com.cxhc.cockpit;


import com.cxhc.common.annotation.Anonymous;
import com.cxhc.common.annotation.DataSource;
import com.cxhc.common.core.domain.R;
import com.cxhc.common.enums.DataSourceType;
import com.cxhc.common.utils.PageUtils;
import com.cxhc.system.domain.cockpit.ViidVehicle;
import com.cxhc.system.service.cockpit.IViidVehicleService;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


/**
 * 人脸
 */
@RestController()
@RequestMapping("/cockpit/ViidVehicle")
@CrossOrigin(origins = "*", maxAge = 3600)
public class ApiViidVehicle {

    @Resource
    private IViidVehicleService viidVehicleService;

    /**
     * 获取人脸信息
     */
    @Anonymous
    @SneakyThrows
    @RequestMapping("/queryVehicle")
    @DataSource(DataSourceType.SLAVE)
    public R<List<ViidVehicle>> queryVehicle() {
        PageUtils.startPage();
        return R.ok(viidVehicleService.queryVehicle());
    }

    /**
     * 获取人脸信息
     */
    @Anonymous
    @SneakyThrows
    @RequestMapping("/queryVehicleCount")
    @DataSource(DataSourceType.SLAVE)
    public R<Map<String,String>> queryVehicleCount(String date) {
        return R.ok(viidVehicleService.queryVehicleCount(date));
    }

}
